home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / WFC010.ZIP / SRC / DCB.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-07  |  4.6 KB  |  132 lines

  1. #include <wfc.h>
  2. #pragma hdrstop
  3.  
  4. /*
  5. ** Author: Samuel R. Blackburn
  6. ** CI$: 76300,326
  7. ** Internet: sammy@sed.csc.com
  8. **
  9. ** You can use it any way you like as long as you don't try to sell it.
  10. **
  11. ** Any attempt to sell WFC in source code form must have the permission
  12. ** of the original author. You can produce commercial executables with
  13. ** WFC but you can't sell WFC.
  14. **
  15. ** Copyright, 1995, Samuel R. Blackburn
  16. **
  17. ** $Workfile: $
  18. ** $Revision: $
  19. ** $Modtime: $
  20. */
  21.  
  22. #if defined( _DEBUG )
  23. #undef THIS_FILE
  24. static char BASED_CODE THIS_FILE[] = __FILE__;
  25. #define new DEBUG_NEW
  26. #endif
  27.  
  28. CDeviceControlBlock::CDeviceControlBlock()
  29. {
  30.    ::ZeroMemory( (DCB *) this, sizeof( DCB ) );
  31.    DCBlength = sizeof( DCB );
  32.    fBinary = TRUE; // Always TRUE for NT
  33. }
  34.  
  35. CDeviceControlBlock::CDeviceControlBlock( const DCB * source )
  36. {
  37.    DCBlength = sizeof( DCB );
  38.  
  39.    Copy( source );
  40. }
  41.  
  42. CDeviceControlBlock::CDeviceControlBlock( const CDeviceControlBlock& source )
  43. {
  44.    DCBlength = sizeof( DCB );
  45.  
  46.    Copy( source );
  47. }
  48.  
  49. CDeviceControlBlock::~CDeviceControlBlock()
  50. {
  51.    DCBlength = 0;
  52. }
  53.  
  54. void CDeviceControlBlock::Copy( const CDeviceControlBlock& source )
  55. {
  56.    Copy( (DCB *) &source );
  57. }
  58.  
  59. void CDeviceControlBlock::Copy( const DCB* source )
  60. {
  61.    ASSERT( source != NULL );
  62.  
  63.    if ( source == NULL )
  64.    {
  65.       ::ZeroMemory( (DCB *) this, sizeof( DCB ) );
  66.       DCBlength = sizeof( DCB );
  67.       fBinary = TRUE; // Always TRUE for NT
  68.       return;
  69.    }
  70.  
  71.    BaudRate          = source->BaudRate;
  72.    fBinary           = source->fBinary;
  73.    fParity           = source->fParity;
  74.    fOutxCtsFlow      = source->fOutxCtsFlow;
  75.    fOutxDsrFlow      = source->fOutxDsrFlow;
  76.    fDtrControl       = source->fDtrControl;
  77.    fDsrSensitivity   = source->fDsrSensitivity;
  78.    fTXContinueOnXoff = source->fTXContinueOnXoff;
  79.    fOutX             = source->fOutX;
  80.    fInX              = source->fInX;
  81.    fErrorChar        = source->fErrorChar;
  82.    fNull             = source->fNull;
  83.    fRtsControl       = source->fRtsControl;
  84.    fDummy2           = source->fDummy2;
  85.    wReserved         = source->wReserved;
  86.    XonLim            = source->XonLim;
  87.    XoffLim           = source->XoffLim;
  88.    ByteSize          = source->ByteSize;
  89.    Parity            = source->Parity;
  90.    StopBits          = source->StopBits;
  91.    XonChar           = source->XonChar;
  92.    XoffChar          = source->XoffChar;
  93.    ErrorChar         = source->ErrorChar;
  94.    EofChar           = source->EofChar;
  95.    EvtChar           = source->EvtChar;
  96. }
  97.  
  98. #if defined( _DEBUG )
  99.  
  100. void CDeviceControlBlock::Dump( CDumpContext& dump_context ) const
  101. {
  102.    dump_context << "a CDeviceControlBlock at " << (void *) this << "\n";
  103.    dump_context << "DCBlength = "         << DCBlength         << "\n";
  104.    dump_context << "BaudRate ="           << BaudRate          << "\n";
  105.    dump_context << "fBinary = "           << fBinary           << "\n";
  106.    dump_context << "fParity = "           << fParity           << "\n";
  107.    dump_context << "fOutxCtsFlow = "      << fOutxCtsFlow      << "\n";
  108.    dump_context << "fOutxDsrFlow = "      << fOutxDsrFlow      << "\n";
  109.    dump_context << "fDtrControl = "       << fDtrControl       << "\n";
  110.    dump_context << "fDsrSensitivity = "   << fDsrSensitivity   << "\n";
  111.    dump_context << "fTXContinueOnXoff = " << fTXContinueOnXoff << "\n";
  112.    dump_context << "fOutX = "             << fOutX             << "\n";
  113.    dump_context << "fInX = "              << fInX              << "\n";
  114.    dump_context << "fErrorChar = "        << fErrorChar        << "\n";
  115.    dump_context << "fNull = "             << fNull             << "\n";
  116.    dump_context << "fRtsControl = "       << fRtsControl       << "\n";
  117.    dump_context << "fDummy2 = "           << fDummy2           << "\n";;
  118.    dump_context << "wReserved = "         << wReserved         << "\n";
  119.    dump_context << "XonLim = "            << XonLim            << "\n";
  120.    dump_context << "XoffLim = "           << XoffLim           << "\n";
  121.    dump_context << "ByteSize = "          << ByteSize          << "\n";
  122.    dump_context << "Parity = "            << Parity            << "\n";
  123.    dump_context << "StopBits = "          << StopBits          << "\n";
  124.    dump_context << "XonChar = "           << XonChar           << "\n";
  125.    dump_context << "XoffChar = "          << XoffChar          << "\n";
  126.    dump_context << "ErrorChar = "         << ErrorChar         << "\n";
  127.    dump_context << "EofChar = "           << EofChar           << "\n";
  128.    dump_context << "EvtChar = "           << EvtChar           << "\n";
  129. }
  130.  
  131. #endif // _DEBUG
  132.